<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript" src="jquery-1.7.1.js"></script>

<body><script type="text/javascript">
window.onload = function(){
	var myTable = document.getElementById("table1");
	var myTBody = myTable.getElementsByTagName("tbody")[0];
	var myTrs = myTBody.getElementsByTagName("tr");
	for(var i =0;i<myTrs.length;i++){
		if(i%2==0){
			myTrs[i].style.backgroundColor="red";
		}else{
			myTrs[i].style.backgroundColor="blue";

		}
	}
	
}
		
		


</script>
<table id="table1">
<tbody>
<tr><td>hello</td><td>hello</td><td>hello</td><td>hello</td></tr>
<tr><td>world</td><td>world</td><td>world</td><td>world</td></tr>
<tr><td>welcome</td><td>welcome</td><td>welcome</td><td>welcome</td></tr>
<tr><td>aaaa</td><td>aaaa</td><td>aaaa</td><td>aaaa</td></tr>
<tr><td>bbbb</td><td>bbbb</td><td>bbbb</td><td>bbbb</td></tr>
<tr><td>cccc</td><td>cccc</td><td>cccc</td><td>cccc</td></tr>
<tr><td>dddd</td><td>dddd</td><td>dddd</td><td>dddd</td></tr>
</tbody>

</table>

</body>


</html>